package com.hong.chapter2;

/**
 * Created by hong on 2018/5/27.
 *
 * 每个线程打印出50个输出
 */
public class BankVersion2 {

    private final  static  int MAX = 50;

    public static void main(String[] args) {
        final  Runnable ticketWindow=()->{
            int index =1;
            while (index<MAX){
                System.out.println(Thread.currentThread().getName()+"窗口"+(index++));
            }
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        };

        Thread thread = new Thread(ticketWindow,"一号");
        Thread thread2 = new Thread(ticketWindow,"二号");
        Thread thread3 = new Thread(ticketWindow,"三号");
        thread.start();
        thread2.start();
        thread3.start();
    }
}
